package com.dehui.traders.viewAdapter;

import android.databinding.BindingAdapter;
import android.support.v7.widget.RecyclerView;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.TextView;

import com.dehui.traders.widgets.CommonAdapter;

import org.w3c.dom.Text;

/**
 * Created by hqq on 18.4.8.
 */

public class RecyclerViewAdapter{

    @BindingAdapter(value = {"setLayoutManager"}, requireAll = false)
    public static void setLayoutManager(final RecyclerView recyclerView, final RecyclerView.LayoutManager layoutManager) {
        recyclerView.setLayoutManager(layoutManager);
    }

    @BindingAdapter(value = {"setListAdapter"}, requireAll = false)
    public static void setListAdapter(final ListView listView, final CommonAdapter adapter){
        listView.setAdapter(adapter);
    }

    @BindingAdapter(value = {"setGridAdapter"}, requireAll = false)
    public static void setGridAdapter(final GridView gridView, final CommonAdapter adapter){
        gridView.setAdapter(adapter);
    }

    @BindingAdapter(value = {"onSelect"})
    public static void onSelect(final TextView textView,final boolean b){
        textView.setSelected(b);
    }

}
